package fr.upmc.i3s.upmcontact.contents;

import java.util.Date;

public abstract class Published extends Content {

	private static final long serialVersionUID = 4385308568349294656L;
	
	private String title;
	private String description;
	private String photoPath;
	private String link;
	private User publishedBy;
	
	public Published() {
		super();
		this.title = null;
		this.description = null;
		this.photoPath = null;
		this.link = null;
		this.publishedBy = null;
	}
	
	public Published(String id, Date createdAt, Date updatedAt,
						String title, String description, String photoPath, String link, User publishedBy) {
		super(id, createdAt, updatedAt);
		this.title = title;
		this.description = description;
		this.photoPath = photoPath;
		this.link = link;
		this.publishedBy = publishedBy;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPhotoPath() {
		return photoPath;
	}

	public void setPhotoPath(String photoPath) {
		this.photoPath = photoPath;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public User getPublishedBy() {
		return publishedBy;
	}

	public void setPublishedBy(User publishedBy) {
		this.publishedBy = publishedBy;
	}

	@Override
	public int hashCode() {
		return super.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		Published other = (Published) obj;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (link == null) {
			if (other.link != null)
				return false;
		} else if (!link.equals(other.link))
			return false;
		if (photoPath == null) {
			if (other.photoPath != null)
				return false;
		} else if (!photoPath.equals(other.photoPath))
			return false;
		if (publishedBy == null) {
			if (other.publishedBy != null)
				return false;
		} else if (!publishedBy.equals(other.publishedBy))
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return super.toString() + " Published [title=" + title + ", description=" + description
				+ ", photoPath=" + photoPath + ", link=" + link
				+ ", publishedBy=" + publishedBy + "]";
	}

}
